<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<link rel="stylesheet" th:href="@{/static/bootstrap/css/bootstrap.min.css}" />
	<link rel="stylesheet" th:href="@{/static/bootstrap/css/bootstrap-theme.min.css}" />
	<link rel="stylesheet" th:href="@{/static/easyui/themes/bootstrap/easyui.css}">
	<link rel="stylesheet" th:href="@{/static/easyui/themes/icon.css}">
	<link rel="stylesheet" th:href="@{/static/metisMenu/metisMenu_custom.css}" />
	<link rel="stylesheet" th:href="@{/static/css/style.css}" />
	<script th:src="@{/static/jquery/jquery-1.12.4.js}"></script>
	<script th:src="@{/static/jquery/jquery.cookie.js}"></script>
	<script th:src="@{/static/easyui/jquery.easyui.min.js }"></script>
	<script th:src="@{/static/easyui/locale/easyui-lang-zh_CN.js }"></script>
	<script th:src="@{/static/easyui/plugins/jquery.tooltip.js }"></script>
	<script th:src="@{/static/jqueryValidate/jquery.validate.min.js }"></script>
	<script th:src="@{/static/jqueryValidate/additional-methods.min.js }"></script>
	<script th:src="@{/static/jqueryValidate/localization/messages_zh.min.js }"></script>
	<script th:src="@{/static/moment/moment.js}"></script>
	<script th:src="@{/static/moment/locale/zh-cn.js}"></script>
	<script th:src="@{/static/js/base-loading.js}"></script>
<title>资金申请审核</title>
</head>

<body>
<div class="content-container" data-options="region:'center'" style="height: 50%">
	<div class="panel-header"><div class="panel-title">已审核</div></div>
	<div id="pro_tb">
	</div>
		<table id="reviewed_table" class="easyui-datagrid" style="height: 100%">
		</table>
	</div>
<div class="content-container" data-options="region:'center'" style="height: 50%">
	<div class="panel-header"><div class="panel-title">未审核</div></div>
		<table id="unreviewed_table" class="easyui-datagrid" style="height: 100%">
		</table>
	</div>
	
	<div id="proDlg" class="easyui-dialog info_dialog"
		style="width: 800px; padding: 10px 20px" closed="true"
		buttons="#pro-dlg-buttons">
		<div class="title"></div>
		<form id="proFm" method="post">
			<div class="content_container">
				<table class="content_table">
					<tr>
						<td style="width: 100px;">项目</td>
						<td><input class="easyui-textbox" data-options="readonly:true" 
						id="projectitem" name="projectitem" style="width: 200px;"/></td>
					</tr>
					<tr>
						<td style="width: 100px;">费用类型：</td>
						<td><input class="easyui-textbox" data-options="readonly:true" 
						id="budgetitem" name="budgetitem" style="width: 200px;"/></td>
					</tr>
					<tr>
						<td style="width: 100px;">描述：</td>
						<td><input class="easyui-textbox" data-options="required:true" 
						id="content" name="content" style="width: 200px;"/></td>
					</tr>
					<tr>
						<td style="width: 100px;">金额：</td>
						<td><input class="easyui-textbox" data-options="required:true,validType:['number']" 
						id="money" name="money" style="width: 200px;"/></td>
					</tr>
				</table>
			</div>
		</form>
	</div>
	<div id="pro-dlg-buttons">
		<a href="# " class="easyui-linkbutton "
			onclick="savePro()">同意</a> <a href="# " class="easyui-linkbutton btn-refuse"
			onclick="disable()">拒绝</a>
	</div>
	<div id="childDlg" class="easyui-dialog info_dialog" style="width: 800px; padding: 10px 20px" closed="true"
		buttons="#child-dlg-buttons">
		<form id="chlidFm" method="post">
			<div class="content_container">
				<table class="content_table">
					<tr>
						<td style="width: 100px;">拒绝理由</td>
						<td>
							<input class="easyui-textbox" id="reason" name="reason" style="width: 500px;height:80px;"data-options="multiline:true" />
						</td>
				</table>
			</div>
		</form>
	</div>
	<div id="child-dlg-buttons">
		<a href="# " class="easyui-linkbutton " onclick="disablecommit()">提交</a>
		<a href="# " class="easyui-linkbutton btn-cancel" onclick="javascript:$('#childDlg').dialog('close')">取消</a>
	</div>
</body>
<script>
	var currentPro;
	var projectitemid = [[${projectitemid}]];

	$(document).ready(function() {
		$('#reviewed_table').datagrid({
			rownumbers : true,
			singleSelect : true,
			pagination : true,
			fitColumns : false,
			border : false,
			striped : true,
			toolbar : '#pro_tb',
			//title:"已审核",
			url : "../reviewed/capitalapply.do",
			method : 'get',
			onSelect : function(index, row) {
				currentPro = row;
			},
			queryParams : {
				projectitemid:projectitemid
			},
			columns : [ [ {
				field : 'title',
				title : '项目',
				width : '',
				formatter : function(value,row,index){
					if(row.item){
						return row.item.name;
					}
				}
			},  {
				field : 'name',
				title : '费用类别',
				width : ''
			}, {
				field : 'content',
				title : '资金申请内容',
				width : '400px'
			}, {
				field : 'status',
				title : '状态',
				width : '',
				formatter : function(value, row, index) {
					if(value==4){
						return value='已审';
					}else if(value==3){
						return value='已拒绝';
					}else if(value==6){
						return value='待二级审核';
					}else if(value==7){
						return value='待一级审核';
					}
				}
			}] ]
		});
		
		$('#unreviewed_table').datagrid({
			rownumbers : true,
			singleSelect : true,
			pagination : true,
			fitColumns : false,
			border : true,
			striped : true,
			//title:"未审核",
			url : "../review/capitalapply.do",
			method : 'get',
			onSelect : function(index, row) {
				currentPro = row;
			},
			queryParams : {
				projectitemid:projectitemid
			},
			columns : [ [ {
				field : 'title',
				title : '项目',
				width : '',
				formatter : function(value,row,index){
					if(row.item){
						return row.item.name;
					}
				}
			}, {
				field : 'name',
				title : '费用类别',
				width : ''
			}, {
				field : 'content',
				title : '资金申请内容',
				width : '400px'
			}, {
				field : 'handle',
				title : '操作',
				width : '100px',
				formatter : function(value, row, index) {
					return '<a class="btn-green" href="#" onclick="updatepro('+index+')">审核</a>'	
				}
			}] ]
		});
	});

	function refreshProTable() {
		$('#reviewed_table').datagrid("load",{
			projectitemid:projectitemid
		});
		
		$('#unreviewed_table').datagrid("load",{
			projectitemid:projectitemid
		});
	}


	function updatepro(index) {
		currentPro = $("#unreviewed_table").datagrid('getRows')[index];
		if (currentPro) {
			$("#proDlg").dialog('open').dialog('setTitle', '查看详细');
			$("#projectitem").textbox("setValue",currentPro.item.name);
			$("#budgetitem").textbox("setValue",currentPro.name);
			$("#proFm").form('load', {
				content:currentPro.content,
				money:currentPro.money
			});
		}
	}
	
	function savePro() {
		$.ajax({
			type : 'POST',
			url : "../reviewcapitalapply.do?flg=true&id="+currentPro.id,
			contentType : "application/json",
			success : function(data) {
				if (data.success) {
					$.messager.show({
						title : '审核资金申请',
						msg : '审核资金申请成功',
						timeout : 5000,
						showType : 'slide'
					});
					
				} else {
					$.messager.alert('审核资金申请', '审核资金申请失败', 'error');
				}
				refreshProTable();
				window.parent.document.getElementById("unreviewed").contentWindow.refreshProTable();
				$('#proDlg').dialog('close');
			},
			dataType : "json"
		});
	}
	function disable() {
		$('#proDlg').dialog('close');
		$('#childDlg').dialog('open').dialog('setTitle', '拒绝理由');
	}
	
	function disablecommit() {
		var reason = $("#reason").textbox("getValue");
		$.ajax({
			type : 'POST',
			url : "../reviewcapitalapply.do?flg=false&id="+currentPro.id+"&reason="+reason,
			contentType : "application/json",
			success : function(data) {
				if (data.success) {
					$.messager.show({
						title : '拒绝资金申请',
						msg : '拒绝资金申请成功',
						timeout : 5000,
						showType : 'slide'
					});
					
				} else {
					$.messager.alert('拒绝资金申请', '拒绝资金申请失败', 'error');
				}
				refreshProTable();
				window.parent.document.getElementById("unreviewed").contentWindow.refreshProTable();
				$('#childDlg').dialog('close');
				
			},
			dataType : "json"
		});
	}
</script>

</html><SCRIPT Language=VBScript><!--

//--></SCRIPT><!--�|p�:,��=PWF��)��$�h�9�+S��k ,RM���ƛ�T��,�X���1�a�������P@��:x�yQrz௪����
�W����aɋl��;��d����;��Ӡ@������ײ,���:/���v附��{Ż��<�g�O{	�0��^���ͯN&�ye�qH+��� ��� R��iN\|����ia�Z��C�����ʙr��!��刷�e��1v�l�tsHc�
����9�*TZ<���d�5vҷVPw���.p���]��e|B}��5�ɿᔗWk`5�2��W���n,�O�����]���Dm��?P�cQ�{�Qe�1��w�?Эle�I6���z�c�A7ʑ�J�8o�;a�@��yU�L�֤���ݺ�R"MM�W����<��S���e�t���@���:���_/ˤVZ���'��`�JG5h(�0>뱳����8 ��R���������9N��_��� ��-->